wayland: always return FALSE from begin_paint
authorRay Strode <rstrode@redhat.com>
Tue, 2 Feb 2016 17:20:22 +0000 (12:20 -0500)
committerRay Strode <rstrode@redhat.com>
Sat, 6 Feb 2016 13:02:57 +0000 (08:02 -0500)
The client and compositor share access to the window
pixel buffers. After the client hands off (commits)
the buffer to the compositor it's not supposed to write
to it again until it's released by the compositor.

The code tries to deal with this contention by allocating
a temporary buffer and using that in the mean time. This
temporary buffer is allocated by a higher layer of the code
when begin_paint returns TRUE. Unfortunately, that layer of
the code has no idea when the buffer is released, so it ends
up blitting the temporary buffer back to the shared buffer
prematurely.

This commit changes begin_paint to always return FALSE.

A future commit will address the contention problem in
a different way.

https://bugzilla.gnome.org/show_bug.cgi?id=761312

gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/gdkprivate-wayland.h
gdk/wayland/gdkwindow-wayland.c

index fcd35022745ed1c9c874d6ba57636c946b682b6c..500e211c5d0fede4c93fcbacd5532eb42abc0c20 100644 (file)
@@ -906,7 +906,6 @@ typedef struct _GdkWaylandCairoSurfaceData {
   struct wl_buffer *buffer;
   GdkWaylandDisplay *display;
   uint32_t scale;
-  gboolean busy;
 } GdkWaylandCairoSurfaceData;
 
 static void
@@ -914,9 +913,7 @@ buffer_release_callback (void             *_data,
                          struct wl_buffer *wl_buffer)
 {
   cairo_surface_t *surface = _data;
-  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
 
-  data->busy = FALSE;
   cairo_surface_destroy (surface);
 }
 
@@ -1001,7 +998,6 @@ _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
   data->display = display;
   data->buffer = NULL;
   data->scale = scale;
-  data->busy = FALSE;
 
   stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width*scale);
 
@@ -1043,21 +1039,6 @@ _gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface)
   return data->buffer;
 }
 
-void
-_gdk_wayland_shm_surface_set_busy (cairo_surface_t *surface)
-{
-  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
-  data->busy = TRUE;
-  cairo_surface_reference (surface);
-}
-
-gboolean
-_gdk_wayland_shm_surface_get_busy (cairo_surface_t *surface)
-{
-  GdkWaylandCairoSurfaceData *data = cairo_surface_get_user_data (surface, &gdk_wayland_cairo_key);
-  return data->busy;
-}
-
 gboolean
 _gdk_wayland_is_shm_surface (cairo_surface_t *surface)
 {
index 9e5151702e11ece240c9508937c113f257575d26..123a33b161b5c1b0c6c27966feb69372e6691180 100644 (file)
@@ -232,8 +232,6 @@ cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *di
                                                            int                height,
                                                            guint              scale);
 struct wl_buffer *_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface);
-void _gdk_wayland_shm_surface_set_busy (cairo_surface_t *surface);
-gboolean _gdk_wayland_shm_surface_get_busy (cairo_surface_t *surface);
 gboolean _gdk_wayland_is_shm_surface (cairo_surface_t *surface);
 
 GdkWaylandSelection * gdk_wayland_display_get_selection (GdkDisplay *display);
index f5a0546c764a2cad5b12d7ee7d1132c02ff21e7e..1c509e59cb83f09e91f3925d055e09bbf18ce40e 100644 (file)
@@ -442,8 +442,6 @@ on_frame_clock_after_paint (GdkFrameClock *clock,
   _gdk_frame_clock_freeze (clock);
 
   wl_surface_commit (impl->display_server.wl_surface);
-  if (_gdk_wayland_is_shm_surface (impl->cairo_surface))
-    _gdk_wayland_shm_surface_set_busy (impl->cairo_surface);
 
   g_signal_emit (impl, signals[COMMITTED], 0);
 }
@@ -641,14 +639,9 @@ gdk_wayland_window_create_similar_image_surface (GdkWindow *     window,
 static gboolean
 gdk_window_impl_wayland_begin_paint (GdkWindow *window)
 {
-  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
-
   gdk_wayland_window_ensure_cairo_surface (window);
 
-  if (_gdk_wayland_is_shm_surface (impl->cairo_surface))
-    return _gdk_wayland_shm_surface_get_busy (impl->cairo_surface);
-  else
-    return FALSE;
+  return FALSE;
 }
 
 static void